Repository navigation
Move HeadinglevelDropdown to its own component - #46003
Conversation
|
|
|
Size Change: -752 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
| setAttributes, | ||
| context: { postType, postId, queryId }, | ||
| } ) { | ||
| const TagName = 0 === level ? 'p' : 'h' + level; |
There was a problem hiding this comment.
I noticed that this code seems to have been adapted for allowing the post title to be a paragraph, but I don't remember this being implemented? It was only implemented for the site title.
Because of the discussions in this issue #30549
I have removed the partial support for p tag.
This comment was marked as outdated.
This comment was marked as outdated.
|
Another reason for adding a new component for this is that developers would like to choose which tags are available, either via theme.json or via a filter. |
Mamaduka
left a comment
There was a problem hiding this comment.
Thank you, @carolinan! The changes test really well for me.
If there are no blockers for native/mobile, then let's merge this. cc @geriux
|
And thank you for the review. |
|
@WordPress/gutenberg-design I feel that this is ready to be merged, but I also think it could be improved if the text "Heading 1" etc, was always visible to the right of the icon inside the dropdown and not only as a tooltip, as discussed in #50402 |
I think it seems a bit redundant to have both. |
|
I did not mean using both tooltip and permanently visible text. I meant the permanent text is an improvement over the tooltip, which covers the other options because of its position. |
|
Right, I mean having "H1" and "Heading 1" right next to it seems a bit redundant. I think the tooltip is performing as expected, if you move to another item, the tooltip moves with it. Is the tooltip only necessary because we don't have visible text, like in other toolbar menus? |
* Add a tag selection component for the block toolbar (replaces HeadingLevelDropdown) * Update index.php * update fixtures * Update CSS class, replace sprintf in the label with the tag name * Add visible tag name to the drop down, add placeholder icon * Update README.md * Try to fix issue with the deprecation * Update CHANGELOG.md * Simplify and rename component * Try reverting fixture changes * And again... * Update Query title to use the new component * Update Comments title * Update Site title with paragraph exception * Update Heading block * Update rich-text.test.js * Block Heading Dropdown - Add support for mobile (WordPress#47967) * Text changes for a native file and e2e test spec * Use the updated headingLevel icons * Update prop names * Add 'options' property to type definiton --------- Co-authored-by: Gerardo Pacheco <gerardo.pacheco@automattic.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
I'd kindly disagree. The tooltip is an usability problem now that the dropdown is vertical, as reported in #55927 and #50402. I don't think keeping both the icon and the visible text is redundant. Instead, it bring sin best of both worlds: a visual hint and an universally understandable visible text. It's not uncommon for many big applications around to display both an icon and visible text. I would also like to remind that icon-only buttons have inherent usability and accessibility problems. Their usage shoudl be limited to only cases where there's not enough space to use visible text. |

What?
Updated May 24.
The HeadingLevelDropdown is a toolbar option used to choose between H1-H6 in the heading block, comments title, query title, and post title. The files are in the heading block, and the other blocks import them.
The site title has its own similar option, and it adds a paragraph to the selection.
This PR moves the HeadingLevelDropdown from the heading block to its own component.
Fixes #45743
Why?
The same code is reused in multiple blocks.
How?
Creates a new component that can be consistently reused in multiple blocks.
Testing Instructions
Screenshots or screencast
Heading block, before (The H1 is hovered over):

After, using the updated icons (The H6 is hovered over):
